<?php


abstract class BaseRegistration extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $invoice;


	
	protected $registrant_id;


	
	protected $conference_id;


	
	protected $status;


	
	protected $bill_first_name;


	
	protected $bill_last_name;


	
	protected $bill_address;


	
	protected $bill_city;


	
	protected $bill_state;


	
	protected $bill_zipcode;


	
	protected $bill_country;


	
	protected $total_fee;


	
	protected $total_paid;


	
	protected $payment_verified;


	
	protected $isdaily;


	
	protected $isearly;


	
	protected $badgedate;


	
	protected $created_at;

	
	protected $aRegistrant;

	
	protected $aConference;

	
	protected $collDonations;

	
	protected $lastDonationCriteria = null;

	
	protected $collSessionRegistrations;

	
	protected $lastSessionRegistrationCriteria = null;

	
	protected $collSpecialEventRegistrations;

	
	protected $lastSpecialEventRegistrationCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getInvoice()
	{

		return $this->invoice;
	}

	
	public function getRegistrantId()
	{

		return $this->registrant_id;
	}

	
	public function getConferenceId()
	{

		return $this->conference_id;
	}

	
	public function getStatus()
	{

		return $this->status;
	}

	
	public function getBillFirstName()
	{

		return $this->bill_first_name;
	}

	
	public function getBillLastName()
	{

		return $this->bill_last_name;
	}

	
	public function getBillAddress()
	{

		return $this->bill_address;
	}

	
	public function getBillCity()
	{

		return $this->bill_city;
	}

	
	public function getBillState()
	{

		return $this->bill_state;
	}

	
	public function getBillZipcode()
	{

		return $this->bill_zipcode;
	}

	
	public function getBillCountry()
	{

		return $this->bill_country;
	}

	
	public function getTotalFee()
	{

		return $this->total_fee;
	}

	
	public function getTotalPaid()
	{

		return $this->total_paid;
	}

	
	public function getPaymentVerified()
	{

		return $this->payment_verified;
	}

	
	public function getIsdaily()
	{

		return $this->isdaily;
	}

	
	public function getIsearly()
	{

		return $this->isearly;
	}

	
	public function getBadgedate($format = 'Y-m-d H:i:s')
	{

		if ($this->badgedate === null || $this->badgedate === '') {
			return null;
		} elseif (!is_int($this->badgedate)) {
						$ts = strtotime($this->badgedate);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [badgedate] as date/time value: " . var_export($this->badgedate, true));
			}
		} else {
			$ts = $this->badgedate;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = RegistrationPeer::ID;
		}

	} 
	
	public function setInvoice($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->invoice !== $v) {
			$this->invoice = $v;
			$this->modifiedColumns[] = RegistrationPeer::INVOICE;
		}

	} 
	
	public function setRegistrantId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->registrant_id !== $v) {
			$this->registrant_id = $v;
			$this->modifiedColumns[] = RegistrationPeer::REGISTRANT_ID;
		}

		if ($this->aRegistrant !== null && $this->aRegistrant->getId() !== $v) {
			$this->aRegistrant = null;
		}

	} 
	
	public function setConferenceId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->conference_id !== $v) {
			$this->conference_id = $v;
			$this->modifiedColumns[] = RegistrationPeer::CONFERENCE_ID;
		}

		if ($this->aConference !== null && $this->aConference->getId() !== $v) {
			$this->aConference = null;
		}

	} 
	
	public function setStatus($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->status !== $v) {
			$this->status = $v;
			$this->modifiedColumns[] = RegistrationPeer::STATUS;
		}

	} 
	
	public function setBillFirstName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_first_name !== $v) {
			$this->bill_first_name = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_FIRST_NAME;
		}

	} 
	
	public function setBillLastName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_last_name !== $v) {
			$this->bill_last_name = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_LAST_NAME;
		}

	} 
	
	public function setBillAddress($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_address !== $v) {
			$this->bill_address = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_ADDRESS;
		}

	} 
	
	public function setBillCity($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_city !== $v) {
			$this->bill_city = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_CITY;
		}

	} 
	
	public function setBillState($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_state !== $v) {
			$this->bill_state = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_STATE;
		}

	} 
	
	public function setBillZipcode($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bill_zipcode !== $v) {
			$this->bill_zipcode = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_ZIPCODE;
		}

	} 
	
	public function setBillCountry($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bill_country !== $v) {
			$this->bill_country = $v;
			$this->modifiedColumns[] = RegistrationPeer::BILL_COUNTRY;
		}

	} 
	
	public function setTotalFee($v)
	{

		if ($this->total_fee !== $v) {
			$this->total_fee = $v;
			$this->modifiedColumns[] = RegistrationPeer::TOTAL_FEE;
		}

	} 
	
	public function setTotalPaid($v)
	{

		if ($this->total_paid !== $v) {
			$this->total_paid = $v;
			$this->modifiedColumns[] = RegistrationPeer::TOTAL_PAID;
		}

	} 
	
	public function setPaymentVerified($v)
	{

		if ($this->payment_verified !== $v) {
			$this->payment_verified = $v;
			$this->modifiedColumns[] = RegistrationPeer::PAYMENT_VERIFIED;
		}

	} 
	
	public function setIsdaily($v)
	{

		if ($this->isdaily !== $v) {
			$this->isdaily = $v;
			$this->modifiedColumns[] = RegistrationPeer::ISDAILY;
		}

	} 
	
	public function setIsearly($v)
	{

		if ($this->isearly !== $v) {
			$this->isearly = $v;
			$this->modifiedColumns[] = RegistrationPeer::ISEARLY;
		}

	} 
	
	public function setBadgedate($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [badgedate] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->badgedate !== $ts) {
			$this->badgedate = $ts;
			$this->modifiedColumns[] = RegistrationPeer::BADGEDATE;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = RegistrationPeer::CREATED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->invoice = $rs->getString($startcol + 1);

			$this->registrant_id = $rs->getInt($startcol + 2);

			$this->conference_id = $rs->getInt($startcol + 3);

			$this->status = $rs->getString($startcol + 4);

			$this->bill_first_name = $rs->getString($startcol + 5);

			$this->bill_last_name = $rs->getString($startcol + 6);

			$this->bill_address = $rs->getString($startcol + 7);

			$this->bill_city = $rs->getString($startcol + 8);

			$this->bill_state = $rs->getString($startcol + 9);

			$this->bill_zipcode = $rs->getInt($startcol + 10);

			$this->bill_country = $rs->getString($startcol + 11);

			$this->total_fee = $rs->getFloat($startcol + 12);

			$this->total_paid = $rs->getFloat($startcol + 13);

			$this->payment_verified = $rs->getBoolean($startcol + 14);

			$this->isdaily = $rs->getBoolean($startcol + 15);

			$this->isearly = $rs->getBoolean($startcol + 16);

			$this->badgedate = $rs->getTimestamp($startcol + 17, null);

			$this->created_at = $rs->getTimestamp($startcol + 18, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 19; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Registration object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(RegistrationPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			RegistrationPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(RegistrationPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(RegistrationPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aRegistrant !== null) {
				if ($this->aRegistrant->isModified()) {
					$affectedRows += $this->aRegistrant->save($con);
				}
				$this->setRegistrant($this->aRegistrant);
			}

			if ($this->aConference !== null) {
				if ($this->aConference->isModified()) {
					$affectedRows += $this->aConference->save($con);
				}
				$this->setConference($this->aConference);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = RegistrationPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += RegistrationPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collDonations !== null) {
				foreach($this->collDonations as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collSessionRegistrations !== null) {
				foreach($this->collSessionRegistrations as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collSpecialEventRegistrations !== null) {
				foreach($this->collSpecialEventRegistrations as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aRegistrant !== null) {
				if (!$this->aRegistrant->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aRegistrant->getValidationFailures());
				}
			}

			if ($this->aConference !== null) {
				if (!$this->aConference->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aConference->getValidationFailures());
				}
			}


			if (($retval = RegistrationPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collDonations !== null) {
					foreach($this->collDonations as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collSessionRegistrations !== null) {
					foreach($this->collSessionRegistrations as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collSpecialEventRegistrations !== null) {
					foreach($this->collSpecialEventRegistrations as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = RegistrationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getInvoice();
				break;
			case 2:
				return $this->getRegistrantId();
				break;
			case 3:
				return $this->getConferenceId();
				break;
			case 4:
				return $this->getStatus();
				break;
			case 5:
				return $this->getBillFirstName();
				break;
			case 6:
				return $this->getBillLastName();
				break;
			case 7:
				return $this->getBillAddress();
				break;
			case 8:
				return $this->getBillCity();
				break;
			case 9:
				return $this->getBillState();
				break;
			case 10:
				return $this->getBillZipcode();
				break;
			case 11:
				return $this->getBillCountry();
				break;
			case 12:
				return $this->getTotalFee();
				break;
			case 13:
				return $this->getTotalPaid();
				break;
			case 14:
				return $this->getPaymentVerified();
				break;
			case 15:
				return $this->getIsdaily();
				break;
			case 16:
				return $this->getIsearly();
				break;
			case 17:
				return $this->getBadgedate();
				break;
			case 18:
				return $this->getCreatedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = RegistrationPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getInvoice(),
			$keys[2] => $this->getRegistrantId(),
			$keys[3] => $this->getConferenceId(),
			$keys[4] => $this->getStatus(),
			$keys[5] => $this->getBillFirstName(),
			$keys[6] => $this->getBillLastName(),
			$keys[7] => $this->getBillAddress(),
			$keys[8] => $this->getBillCity(),
			$keys[9] => $this->getBillState(),
			$keys[10] => $this->getBillZipcode(),
			$keys[11] => $this->getBillCountry(),
			$keys[12] => $this->getTotalFee(),
			$keys[13] => $this->getTotalPaid(),
			$keys[14] => $this->getPaymentVerified(),
			$keys[15] => $this->getIsdaily(),
			$keys[16] => $this->getIsearly(),
			$keys[17] => $this->getBadgedate(),
			$keys[18] => $this->getCreatedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = RegistrationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setInvoice($value);
				break;
			case 2:
				$this->setRegistrantId($value);
				break;
			case 3:
				$this->setConferenceId($value);
				break;
			case 4:
				$this->setStatus($value);
				break;
			case 5:
				$this->setBillFirstName($value);
				break;
			case 6:
				$this->setBillLastName($value);
				break;
			case 7:
				$this->setBillAddress($value);
				break;
			case 8:
				$this->setBillCity($value);
				break;
			case 9:
				$this->setBillState($value);
				break;
			case 10:
				$this->setBillZipcode($value);
				break;
			case 11:
				$this->setBillCountry($value);
				break;
			case 12:
				$this->setTotalFee($value);
				break;
			case 13:
				$this->setTotalPaid($value);
				break;
			case 14:
				$this->setPaymentVerified($value);
				break;
			case 15:
				$this->setIsdaily($value);
				break;
			case 16:
				$this->setIsearly($value);
				break;
			case 17:
				$this->setBadgedate($value);
				break;
			case 18:
				$this->setCreatedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = RegistrationPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setInvoice($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setRegistrantId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setConferenceId($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setStatus($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setBillFirstName($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setBillLastName($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setBillAddress($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setBillCity($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setBillState($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setBillZipcode($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setBillCountry($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setTotalFee($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setTotalPaid($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setPaymentVerified($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setIsdaily($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setIsearly($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setBadgedate($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setCreatedAt($arr[$keys[18]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(RegistrationPeer::DATABASE_NAME);

		if ($this->isColumnModified(RegistrationPeer::ID)) $criteria->add(RegistrationPeer::ID, $this->id);
		if ($this->isColumnModified(RegistrationPeer::INVOICE)) $criteria->add(RegistrationPeer::INVOICE, $this->invoice);
		if ($this->isColumnModified(RegistrationPeer::REGISTRANT_ID)) $criteria->add(RegistrationPeer::REGISTRANT_ID, $this->registrant_id);
		if ($this->isColumnModified(RegistrationPeer::CONFERENCE_ID)) $criteria->add(RegistrationPeer::CONFERENCE_ID, $this->conference_id);
		if ($this->isColumnModified(RegistrationPeer::STATUS)) $criteria->add(RegistrationPeer::STATUS, $this->status);
		if ($this->isColumnModified(RegistrationPeer::BILL_FIRST_NAME)) $criteria->add(RegistrationPeer::BILL_FIRST_NAME, $this->bill_first_name);
		if ($this->isColumnModified(RegistrationPeer::BILL_LAST_NAME)) $criteria->add(RegistrationPeer::BILL_LAST_NAME, $this->bill_last_name);
		if ($this->isColumnModified(RegistrationPeer::BILL_ADDRESS)) $criteria->add(RegistrationPeer::BILL_ADDRESS, $this->bill_address);
		if ($this->isColumnModified(RegistrationPeer::BILL_CITY)) $criteria->add(RegistrationPeer::BILL_CITY, $this->bill_city);
		if ($this->isColumnModified(RegistrationPeer::BILL_STATE)) $criteria->add(RegistrationPeer::BILL_STATE, $this->bill_state);
		if ($this->isColumnModified(RegistrationPeer::BILL_ZIPCODE)) $criteria->add(RegistrationPeer::BILL_ZIPCODE, $this->bill_zipcode);
		if ($this->isColumnModified(RegistrationPeer::BILL_COUNTRY)) $criteria->add(RegistrationPeer::BILL_COUNTRY, $this->bill_country);
		if ($this->isColumnModified(RegistrationPeer::TOTAL_FEE)) $criteria->add(RegistrationPeer::TOTAL_FEE, $this->total_fee);
		if ($this->isColumnModified(RegistrationPeer::TOTAL_PAID)) $criteria->add(RegistrationPeer::TOTAL_PAID, $this->total_paid);
		if ($this->isColumnModified(RegistrationPeer::PAYMENT_VERIFIED)) $criteria->add(RegistrationPeer::PAYMENT_VERIFIED, $this->payment_verified);
		if ($this->isColumnModified(RegistrationPeer::ISDAILY)) $criteria->add(RegistrationPeer::ISDAILY, $this->isdaily);
		if ($this->isColumnModified(RegistrationPeer::ISEARLY)) $criteria->add(RegistrationPeer::ISEARLY, $this->isearly);
		if ($this->isColumnModified(RegistrationPeer::BADGEDATE)) $criteria->add(RegistrationPeer::BADGEDATE, $this->badgedate);
		if ($this->isColumnModified(RegistrationPeer::CREATED_AT)) $criteria->add(RegistrationPeer::CREATED_AT, $this->created_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(RegistrationPeer::DATABASE_NAME);

		$criteria->add(RegistrationPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setInvoice($this->invoice);

		$copyObj->setRegistrantId($this->registrant_id);

		$copyObj->setConferenceId($this->conference_id);

		$copyObj->setStatus($this->status);

		$copyObj->setBillFirstName($this->bill_first_name);

		$copyObj->setBillLastName($this->bill_last_name);

		$copyObj->setBillAddress($this->bill_address);

		$copyObj->setBillCity($this->bill_city);

		$copyObj->setBillState($this->bill_state);

		$copyObj->setBillZipcode($this->bill_zipcode);

		$copyObj->setBillCountry($this->bill_country);

		$copyObj->setTotalFee($this->total_fee);

		$copyObj->setTotalPaid($this->total_paid);

		$copyObj->setPaymentVerified($this->payment_verified);

		$copyObj->setIsdaily($this->isdaily);

		$copyObj->setIsearly($this->isearly);

		$copyObj->setBadgedate($this->badgedate);

		$copyObj->setCreatedAt($this->created_at);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getDonations() as $relObj) {
				$copyObj->addDonation($relObj->copy($deepCopy));
			}

			foreach($this->getSessionRegistrations() as $relObj) {
				$copyObj->addSessionRegistration($relObj->copy($deepCopy));
			}

			foreach($this->getSpecialEventRegistrations() as $relObj) {
				$copyObj->addSpecialEventRegistration($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new RegistrationPeer();
		}
		return self::$peer;
	}

	
	public function setRegistrant($v)
	{


		if ($v === null) {
			$this->setRegistrantId(NULL);
		} else {
			$this->setRegistrantId($v->getId());
		}


		$this->aRegistrant = $v;
	}


	
	public function getRegistrant($con = null)
	{
		if ($this->aRegistrant === null && ($this->registrant_id !== null)) {
						include_once 'lib/model/om/BaseRegistrantPeer.php';

			$this->aRegistrant = RegistrantPeer::retrieveByPK($this->registrant_id, $con);

			
		}
		return $this->aRegistrant;
	}

	
	public function setConference($v)
	{


		if ($v === null) {
			$this->setConferenceId(NULL);
		} else {
			$this->setConferenceId($v->getId());
		}


		$this->aConference = $v;
	}


	
	public function getConference($con = null)
	{
		if ($this->aConference === null && ($this->conference_id !== null)) {
						include_once 'lib/model/om/BaseConferencePeer.php';

			$this->aConference = ConferencePeer::retrieveByPK($this->conference_id, $con);

			
		}
		return $this->aConference;
	}

	
	public function initDonations()
	{
		if ($this->collDonations === null) {
			$this->collDonations = array();
		}
	}

	
	public function getDonations($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseDonationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDonations === null) {
			if ($this->isNew()) {
			   $this->collDonations = array();
			} else {

				$criteria->add(DonationPeer::REGISTRATION_ID, $this->getId());

				DonationPeer::addSelectColumns($criteria);
				$this->collDonations = DonationPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(DonationPeer::REGISTRATION_ID, $this->getId());

				DonationPeer::addSelectColumns($criteria);
				if (!isset($this->lastDonationCriteria) || !$this->lastDonationCriteria->equals($criteria)) {
					$this->collDonations = DonationPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastDonationCriteria = $criteria;
		return $this->collDonations;
	}

	
	public function countDonations($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseDonationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(DonationPeer::REGISTRATION_ID, $this->getId());

		return DonationPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addDonation(Donation $l)
	{
		$this->collDonations[] = $l;
		$l->setRegistration($this);
	}

	
	public function initSessionRegistrations()
	{
		if ($this->collSessionRegistrations === null) {
			$this->collSessionRegistrations = array();
		}
	}

	
	public function getSessionRegistrations($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSessionRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSessionRegistrations === null) {
			if ($this->isNew()) {
			   $this->collSessionRegistrations = array();
			} else {

				$criteria->add(SessionRegistrationPeer::REGISTRATION_ID, $this->getId());

				SessionRegistrationPeer::addSelectColumns($criteria);
				$this->collSessionRegistrations = SessionRegistrationPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(SessionRegistrationPeer::REGISTRATION_ID, $this->getId());

				SessionRegistrationPeer::addSelectColumns($criteria);
				if (!isset($this->lastSessionRegistrationCriteria) || !$this->lastSessionRegistrationCriteria->equals($criteria)) {
					$this->collSessionRegistrations = SessionRegistrationPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastSessionRegistrationCriteria = $criteria;
		return $this->collSessionRegistrations;
	}

	
	public function countSessionRegistrations($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseSessionRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(SessionRegistrationPeer::REGISTRATION_ID, $this->getId());

		return SessionRegistrationPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addSessionRegistration(SessionRegistration $l)
	{
		$this->collSessionRegistrations[] = $l;
		$l->setRegistration($this);
	}


	
	public function getSessionRegistrationsJoinSession($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSessionRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSessionRegistrations === null) {
			if ($this->isNew()) {
				$this->collSessionRegistrations = array();
			} else {

				$criteria->add(SessionRegistrationPeer::REGISTRATION_ID, $this->getId());

				$this->collSessionRegistrations = SessionRegistrationPeer::doSelectJoinSession($criteria, $con);
			}
		} else {
									
			$criteria->add(SessionRegistrationPeer::REGISTRATION_ID, $this->getId());

			if (!isset($this->lastSessionRegistrationCriteria) || !$this->lastSessionRegistrationCriteria->equals($criteria)) {
				$this->collSessionRegistrations = SessionRegistrationPeer::doSelectJoinSession($criteria, $con);
			}
		}
		$this->lastSessionRegistrationCriteria = $criteria;

		return $this->collSessionRegistrations;
	}

	
	public function initSpecialEventRegistrations()
	{
		if ($this->collSpecialEventRegistrations === null) {
			$this->collSpecialEventRegistrations = array();
		}
	}

	
	public function getSpecialEventRegistrations($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpecialEventRegistrations === null) {
			if ($this->isNew()) {
			   $this->collSpecialEventRegistrations = array();
			} else {

				$criteria->add(SpecialEventRegistrationPeer::REGISTRATION_ID, $this->getId());

				SpecialEventRegistrationPeer::addSelectColumns($criteria);
				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(SpecialEventRegistrationPeer::REGISTRATION_ID, $this->getId());

				SpecialEventRegistrationPeer::addSelectColumns($criteria);
				if (!isset($this->lastSpecialEventRegistrationCriteria) || !$this->lastSpecialEventRegistrationCriteria->equals($criteria)) {
					$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastSpecialEventRegistrationCriteria = $criteria;
		return $this->collSpecialEventRegistrations;
	}

	
	public function countSpecialEventRegistrations($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(SpecialEventRegistrationPeer::REGISTRATION_ID, $this->getId());

		return SpecialEventRegistrationPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addSpecialEventRegistration(SpecialEventRegistration $l)
	{
		$this->collSpecialEventRegistrations[] = $l;
		$l->setRegistration($this);
	}


	
	public function getSpecialEventRegistrationsJoinSpecialEvent($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpecialEventRegistrations === null) {
			if ($this->isNew()) {
				$this->collSpecialEventRegistrations = array();
			} else {

				$criteria->add(SpecialEventRegistrationPeer::REGISTRATION_ID, $this->getId());

				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelectJoinSpecialEvent($criteria, $con);
			}
		} else {
									
			$criteria->add(SpecialEventRegistrationPeer::REGISTRATION_ID, $this->getId());

			if (!isset($this->lastSpecialEventRegistrationCriteria) || !$this->lastSpecialEventRegistrationCriteria->equals($criteria)) {
				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelectJoinSpecialEvent($criteria, $con);
			}
		}
		$this->lastSpecialEventRegistrationCriteria = $criteria;

		return $this->collSpecialEventRegistrations;
	}

} 